#ifndef __uart_h
#define __uart_h


#define setWifiPower P0_2=1
#define clrWifiPower P0_2=0


#define data0 sendBuff[6]
#define data1 sendBuff[7]
#define data2 sendBuff[8]
#define data3 sendBuff[9]
#define data4 sendBuff[10]
#define data5 sendBuff[11] 
#define data6 sendBuff[12] 
#define data7 sendBuff[13]
#define data8 sendBuff[14]
#define data9 sendBuff[15]
#define data10 sendBuff[16] 
#define data11 sendBuff[17] 
#define data12  sendBuff[18]
#define data13  sendBuff[19]
#define data14  sendBuff[20]
#define data15  sendBuff[21]
#define data16  sendBuff[22]
#define data17  sendBuff[23]
#define data18  sendBuff[24]
#define data19  sendBuff[25]
#define data20  sendBuff[26]
#define data21  sendBuff[27]
#define data22  sendBuff[28]
#define data23  sendBuff[29]
#define data24  sendBuff[30]
#define data25  sendBuff[31]
#define data26  sendBuff[32]
#define data27  sendBuff[33]
#define data28  sendBuff[34]
#define data29  sendBuff[35]
#define data30  sendBuff[36]
#define data31  sendBuff[37]
#define data32  sendBuff[38]
#define data33  sendBuff[39]
#define data34  sendBuff[40]


#define DianYuanKai		data0|=bit1
#define DianYuanGuan	data0&=cbit1

#define JiaReZhuangTaiWu		data0&=cbit2;data0&=cbit3
#define JiaReZhuangTaiJiaReZhong	data0&=cbit3;data0|=bit2
#define JiaReZhuangTaiBaoWenZhong	data0&=cbit2;data0|=bit3
#define JiaReZhuangTaiFangDongJie  data0|=bit3;data0|=bit2

#define YuYueKai		data0|=bit4
#define YuYueGuan		data0&=cbit4

#define AnQuanGongNengKai data0|=bit5
#define AnQuanGongNengGuan data0&=cbit5

#define AnQuanZiJianZhong  data0|=bit6
#define AnQuanZiJianWanCHeng  data0&=cbit6

#define APPJieBangYes data0|=bit7
#define APPJieBangNo	data0&=cbit7

#define WIFIChongZhiYes data0|=bit8
#define WIFIChongZhiNo data0&=cbit8

#define DianReZhuangTaiWu		data1&=0x00
#define DianReZhuangTai1000W	data1=bit1
#define DianReZhuangTai2000W	data1=bit2
#define DianReZhuangTai3000W	data1|=bit2;data1|=bit1

#define  ShouDongMoShi			data2=b0000_1101;
#define  ShengDianMoShi			data2=b0000_1110;
#define  ZengRongMOShi			data2=b0000_1111;

#define  LouDianGuZhang         data29=0x00;
#define  GanShaoBaoHu 			data29=0x01;
#define  ChuanGanQiGuZhangBaoHu  data29=0x02;
#define  ChaoWenBaoHu			data29=0x08;
#define  DuanLuBaoHu			data29=0x10;
#define  TanTouKaiLu			data29=0x20;

#define  BanBenZhengShu			data30=0x02;
#define  BanBenXiaoShu			data31=0x00;


#ifdef __uart_c

bit f_4ms;
uint16_t d_1500ms;
uint8_t yiHuo;
uint8_t yiHuo1;
uint8_t uartBuff[18];
uint8_t step;
bit bFinish;
uint8_t finishStep;
uint8_t wifiNum;
uint8_t wifiLedHoldTime;
bit bWifLed;
uint8_t flashWifi;
bit bSend;
uint8_t sendBuff[48];
uint8_t step;
uint8_t holdLostWifiTime;
bit bDownWifiPower;
uint8_t downWifiPowerTime;
uint8_t downWifiPowerNum;

uint8_t orderClockOpenHour1;
uint8_t orderClockOpenMin1;
uint8_t orderClockCloseHour1;
uint8_t orderClockCloseMin1;
uint8_t orderClockOpenHour2;
uint8_t orderClockOpenMin2;
uint8_t orderClockCloseHour2;
uint8_t orderClockCloseMin2;
uint8_t orderClockOpenHour3;
uint8_t orderClockOpenMin3;
uint8_t orderClockCloseHour3;
uint8_t orderClockCloseMin3;
uint8_t yuYueWenDu1;
uint8_t yuYueWenDu2;
uint8_t yuYueWenDu3;
uint8_t bYuYue1;
uint8_t bYuYue2;
uint8_t bYuYue3;
int16_t orderClockOpen;
uint16_t orderClockClose;

#else

extern	int16_t orderClockOpen;
extern uint16_t orderClockClose;
extern	uint8_t bYuYue1;
extern uint8_t bYuYue2;
extern uint8_t bYuYue3;
extern uint8_t orderClockOpenHour1;
extern uint8_t orderClockOpenMin1;
extern uint8_t orderClockCloseHour1;
extern uint8_t orderClockCloseMin1;
extern uint8_t orderClockOpenHour2;
extern uint8_t orderClockOpenMin2;
extern uint8_t orderClockCloseHour2;
extern uint8_t orderClockCloseMin2;
extern uint8_t orderClockOpenHour3;
extern uint8_t orderClockOpenMin3;
extern uint8_t orderClockCloseHour3;
extern uint8_t orderClockCloseMin3;
extern uint8_t yuYueWenDu1;
extern uint8_t yuYueWenDu2;
extern uint8_t yuYueWenDu3;
extern uint8_t downWifiPowerNum;
extern	uint8_t holdLostWifiTime;
extern bit bDownWifiPower;
extern uint8_t downWifiPowerTime;
	extern uint8_t yiHuo1;
	extern uint8_t step;
extern uint8_t sendBuff[48];
extern bit bSend;
extern uint8_t flashWifi;
extern uint8_t wifiLedHoldTime;
extern bit bWifLed;
extern uint8_t wifiNum;
extern uint8_t finishStep;
extern bit bFinish;
extern uint8_t step;
extern uint8_t uartBuff[18];
extern uint8_t yiHuo;
extern bit f_4ms;
extern uint16_t d_1500ms;
#endif
void UARTFaSong();
void TIMER1_setup();
void UART_setup();
void 	UARTJieShou();
#endif
